﻿/// <reference path="../jquery.min.js" />
/// <reference path="../module/rsseasy.v2.js" />
/// <reference path="../module/rssapi.v2.js" />

$(function () {
    var integraltocouponpage = $("#integraltocouponpage");
    integraltocouponpage.find("[useintegral]").html(RssUser.Data.integral);

    integraltocouponpage.load(function () {

        RssApi.Table.List("discount_coupon").setLoading().condition({ "state": 1, "integral": "{gt~0}" }).getJson(function (data) {
            $("#integralcouponitemwrap").mapview(data).find("[mapattr][rssid]").click(function () {

                //兑换优惠券
                new Ajax("integral/convert/coupon").keyvalue("id", $(this).attr("rssid")).keymyid().getJson(function (data) {
                });
            });
        });
    });
});